package api

import (
	"github.com/gin-gonic/gin"
	"video_-chat/api/handler"
	"video_-chat/api/middlewere"
)

func Run(r *gin.Engine) {
	Origin := r.Group("/")
	Origin.Use(middlewere.Origin())
	{
		Origin.POST("/login", handler.Login)
		Origin.POST("/sms", handler.Sms)
		LoginEd := Origin.Group("/")
		LoginEd.Use(middlewere.Logined())
		Video := LoginEd.Group("/video")
		{
			Video.POST("/list/get", handler.VideoListGet)
			Video.POST("/get", handler.VideoGet)
			Video.POST("/exit", handler.VideoExit)
			Video.POST("/login/get", handler.VideoLoginGet)
			Comment := Video.Group("/comment")
			{
				Comment.POST("/push", handler.VideoCommentPush)
				Comment.POST("/get", handler.VideoCommentGet)
				Comment.POST("/like", handler.VideoCommentLike)
			}
			Barrage := Video.Group("/barrage")
			{
				Barrage.POST("/push", handler.VideoBarragePush)
				Barrage.POST("/Get", handler.VideoBarrageGet)
			}
		}
		User := LoginEd.Group("/user")
		{
			User.POST("/data", handler.UserData)
			User.POST("/follow", handler.UserFollow)
			User.POST("/hand_image/update", handler.UserHandImageUpdate)
		}
		Chat := LoginEd.Group("/chat")
		{
			Chat.GET("/conn", handler.ChatConn)
			Chat.POST("/list", handler.ChatList)
			Chat.POST("/read/not_count", handler.ReadNotCount)
			Chat.POST("/read/all", handler.Readall)
		}
	}
}
